<template>
  <div class="mailWrap">
    <!-- 邮箱登录 -->
    <div class="weui-cell">
      <div class="weui-cell__hd">
        <label class="weui-label">手机</label>
      </div>
      <div class="weui-cell__bd">
        <input class="weui-input" type="tel" v-model="tel" placeholder="请输入手机号">
      </div>
    </div>
    <!-- 按钮 -->
    <a data-v-3a4b7fa7="" href="javascript:;" class="weui-btn weui-btn_primary" @click="submit">确定</a>
  </div>
</template>

<script>
export default {
  data() {
    return {
      tel: ''
    }
  },
  methods: {
    submit() {
      var reg = /\d{11}/.test(this.tel)
      if (reg) {
        this.$axios.post(`${this.$url}/account/bind?phone=${this.tel}`)
          .then(res => {
            console.log(res)
            // 成功回调
            if (res.data.IsSuccess) {
              this.$router.push('/success')
            } else {
              weui.alert(res.data.Msg)
            }
          })
          .catch(err => {
            //alert(JSON.stringify(err))
            weui.alert(err.Data.Msg)
          })
      } else {
        weui.topTips('请输入正确的手机')
      }
    }
  },
  created() {

  }
}
</script>
 
<style lang='less' scoped>
.mailWrap {
  text-align: left;
  padding-top: 80px;
  font-size: 17px;
}

.weui-btn {
  margin: 0 15px;
  margin-top: 60px; // text-decoration: none;
}
</style>
<style lang="css">
.weui-btn_primary {
  background-color: #19A4FF;
  text-decoration: none;
}

.weui-btn_primary:not(.weui-btn_disabled):active {
  background-color: #19A4FF;
}
</style>